package chapter01

/**
  * 伴生类
  * 在scala类中声明了两个的成员变量
  *
  * @param name
  * @param age
  */
class Student(val name: String, var age: Int) {

  def printInfo(): Unit = {
    // 伴生类可以直接调用伴生对象中的变量和方法
    println("name" + this.name + "school" + Student.school)

  }
}

// 引入伴生对象
// 入口对象Student$
object Student {
  val school: String = "fjw"

  def main(args: Array[String]): Unit = {
    val student = new Student("刘备",59)
    student.printInfo();
  }
}
